/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package rainbow;

import com.aqlm.util.PropertiesUtil;
//import org.rainbow.xml.reader.FileSystemResourceXmlReader;
//import org.rainbow.xml.reader.XmlReader;
//import org.rainbow.xml.writer.FileSystemResourceXmlWriter;
//import org.rainbow.xml.writer.XmlWriter;
import java.io.File;
import java.io.IOException;
import java.util.List;

/**
 *
 * @author hironaga
 */
public class Main {

    static String dirpath = "C://dev/DevData/AQLM";

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
                throws IOException, InstantiationException, IllegalAccessException {

//        //create instance
//        XmlReader reader = new FileSystemResourceXmlReader();
//        XmlWriter writer = new FileSystemResourceXmlWriter();

//        //"rsv.xml"
//        //Read
//        String filename = "/RSV/200811/RSV_20081205_202058506.xml";
//        File rsvXML = new File(dirpath + filename);
//        String rsvXpath = PropertiesUtil.getXPath("rsv.elements.element");
////        List<RSVBean> rsvs = reader.read(rsvXpath, RSVBean.class, rsvXML);
////        for(RSVBean rsv : rsvs){
////            System.out.println(rsv.toString());
////        }
//        List<RSVBeanSimple> rsvSmpls = reader.readList(rsvXpath, RSVBeanSimple.class, rsvXML);
//        //Write
//        String newfilename = "/RSV/200811/RSV_20081205_XXXXXXXX.xml";
//        File newXML = new File(dirpath + newfilename);
//        if(!newXML.exists()){
//            newXML.createNewFile();
//        }
//        else{
//            newXML.delete();
//            newXML.createNewFile();
//        }
//        for(RSVBeanSimple rsv : rsvSmpls){
//            System.out.println(rsv.toString());
//            writer.writeObject(rsvXpath, rsv, newXML);
//        }

//        //"rsv_manager.xml"
//        //Read
//        String rsvMngFileName = "/RSV/RSV_MANAGER_200810.xml";
//        File rsvMngXML = new File(dirpath + rsvMngFileName);
//        String rsvMngXpath = PropertiesUtil.getXPath("rsvmsg.elements.element.rsv");
//        //String rsvMngXpath = PropertiesUtil.getXPath("rsv.elements.element");
//        List<RsvMngBean> rsvManagers = reader.readList(rsvMngXpath, RsvMngBean.class, rsvMngXML );
//        for(RsvMngBean rsvManager : rsvManagers){
//            System.out.println(rsvManager.toString());
//        }
//        //Write
//        String newRsvMngfilename = "/RSV/RSV_MANAGER_XXXXXX.xml";
//        String newRsvMngfilenameList = "/RSV/RSV_MANAGER_XXXXXX_List.xml";
//        File newRsvMngXML = new File(dirpath + newRsvMngfilename);
//        File newRsvMngXmlList = new File(dirpath + newRsvMngfilenameList);
//        if(!newRsvMngXML.exists()){
//            newRsvMngXML.createNewFile();
//        }
//        else{
//            newRsvMngXML.delete();
//            newRsvMngXML.createNewFile();
//        }
//        if(!newRsvMngXmlList.exists()){
//            newRsvMngXmlList.createNewFile();
//        }
//        else{
//            newRsvMngXmlList.delete();
//            newRsvMngXmlList.createNewFile();
//        }
//        //write object
//        writer.writeObject(rsvMngXpath, rsvManagers.get(0), newRsvMngXML);
//        //write list
//        writer.writeList(rsvMngXpath, rsvManagers, newRsvMngXmlList);



//        //append
//        RsvMngBean appendRsvManger = new RsvMngBean();
//        //appendRsvManger.setChecked(true);
//        appendRsvManger.setCheckedStr("0");
//        appendRsvManger.setFileName("新しいファイル名です");
        //rsvManagers.add(appendRsvManger);
//        writer.appendObject(rsvMngXpath, appendRsvManger, newRsvMngXML);
//        writer.appendList(rsvMngXpath, rsvManagers, newRsvMngXmlList);

    }

}
